package ataques;

public abstract class BaseAtaque {

	protected int[][] desc;
	protected int iw,ih;
	
	public BaseAtaque(int w, int h) {
		
		this.iw = w/2;
		this.ih = h/2;
		this.desc = new int[iw][ih];
	}
	
	public int[][] getDesc() {
		return desc;
	}
	
	protected int[][] superImposeTres(boolean[][] C, boolean[][] M, boolean[][] Y) { 

        int [][] result= new int [C.length][C[0].length];

        for(int i=0;i<C.length;i++){
            for(int j = 0; j<C[0].length;j++){
                int sum = 0;

                if(C[i][j]==true)
                    sum+=4;
                if(M[i][j]==true)
                    sum+=2;
                if(Y[i][j]==true)
                    sum+=1;

                /*
				 * CONVERSION TABLE
				 *
				 * C=4		M=2		Y=1
				 *
				 * 		C	M	Y
				 * 0					= 0
				 * 1	X				= 4
				 * 2		X			= 2
				 * 3			X		= 1
				 * 4	X	X			= 6
				 * 5		X	X		= 3
				 * 6	X		X		= 5
				 * 7	X	X	X		= 7 negro
				 *
				 *
				 * difungir
				 */

                switch(sum){
                    case 0: result[i][j]=0;
                            break;
                    case 1: result[i][j]=3;
                            break;
                    case 2: result[i][j]=2;
                            break;
                    case 3: result[i][j]=5;
                            break;
                    case 4: result[i][j]=1;
                            break;
                    case 5: result[i][j]=6;
                            break;
                    case 6: result[i][j]=4;
                            break;
                    case 7: result[i][j]=7;
                            break;
                }
            }
        }

        return result;
	}
	

	public abstract void runAttack();
}
